package com.example.demo.service.impl;

import com.example.demo.mapper.CourseMapper;
import com.example.demo.pojo.Course;
import com.example.demo.service.CourseService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {
    @Autowired
    private CourseMapper courseMapper;
    @Override
    public void deleteCourseByCno(int cno) {
        courseMapper.deleteCourseByCno(cno);
    }

    @Override
    public List<Course> getAllCourse(Integer page,Integer size) {
        PageHelper.startPage(page,size);
        return courseMapper.getAllCourse(page,size);
    }

    @Override
    public List<Course> queryCourse(String cname) {
        return courseMapper.queryCourse(cname);
    }

    @Override
    public Course getCourseStudent(int cno) {
        return courseMapper.getCourseStudent(cno);
    }
}
